<?php

namespace other;

class Log
{
    /**
     * 日志记录
     * @param $mesg
     * @return void
     */
    static public function airwallex($mesg){self::store($mesg,'airwallex');}
    static public function email($mesg){self::store($mesg,'email');}
    static public function ip($mesg){self::store($mesg,'ip');}
    static public function order($mesg){self::store($mesg,'order');}
    static public function payoneer($mesg){self::store($mesg,'payoneer');}
    static public function paypal($mesg){self::store($mesg,'paypal');}
    static public function tongtu($mesg){self::store($mesg,'tongtu');}
    static public function ddhd($mesg){self::store($mesg,'ddhd');}
    static public function sql($mesg){self::store($mesg,'sql');}


    /**
     * 日志存储
     * @param $mesg
     * @param $type
     * @return void
     */
    static private function store($mesg,$type='airwallex')
    {
        if (!$mesg) return;
        if (is_array($mesg)){
            $mesg = json_encode($mesg);
        }

        $createtime = time();
        $status = $type;
        $content = $mesg;

        \app\admin\model\Log::create(compact("createtime","status","content"));
    }
}
